// 结构体定义中的泛型
// @author 风杨
// @date 22-9-8 上午11:35
// @see <a href="yueny09@163.com">mailTo: yueny09@163.com</a>
//

pub fn structWithSyn(){
    let intterger = Point{
        x: 8, y:9
    };
    println!("intterger:{:?}.", intterger);

    let float = Point{
        x: 8.0, y:9.0
    };
    println!("float:{:?}.", float);

    let integer_and_float = PointMore{
        x: 8, y:9.0
    };
    println!("integer_and_float:{:?}.", integer_and_float);

    let integer_and_float1 = PointMore{
        x: 8.0, y:99
    };
    println!("integer_and_float1:{:?}.", integer_and_float1);
}

#[derive(Debug)]
struct Point<T> {
    x: T,
    y: T,
}

// 不同类型且仍然是泛型的 Point 结构体'
#[derive(Debug)]
struct PointMore<T, U> {
    x: T,
    y: U,
}
